<#include "layout/template.ftl"/>

<@htmlHead title="新增短信通道">
   <style>
    	
    	
    </style>
</@htmlHead>


 
<@htmlBody 'sms' 'messageChannelManage'>

	<!-- breadcrumbs begin -->
	<#include "layout/breadcrumbs.ftl">
	<@breadcrumbs '短信通道管理' '新增短信通道'></@breadcrumbs>
	<!-- breadcrumbs end -->

	<!-- page-content begin -->
	<div class="page-content">
			
			<!-- page-header begin -->
			<div class="page-header">
					<h1>
						新增短信通道
					</h1>
			</div>
			<!-- page-header end -->

			<!-- page-body begin -->
			<div class="row">	
				<div class="col-md-8 col-md-offset-2">
				
						<!-- 表单开始 -->
						<form class="form-horizontal" id="validation-form" method="post" action="${path}/manage/sms/messageChannel/create" >
								
								<div class="form-group">
									<label class="control-label col-md-2 no-padding-right" for="name">签名:</label>
									<div class="col-md-10">
										<div class="clearfix">
											<input type="text" class="form-control" placeholder="请输入签名" name="sign"   id="sign" value="${messageChannel.sign}" />
										</div>
									</div>
								</div>
								
								<div class="form-group">
									<label class="control-label col-md-2 no-padding-right" for="name">URL:</label>
									<div class="col-md-10">
										<div class="clearfix">
											<input type="text" class="form-control" placeholder="请输入URL" name="url"   id="url" value="${messageChannel.url}" />
										</div>
									</div>
								</div>
								
								<div class="form-group">
									<label class="control-label col-md-2 no-padding-right" for="cpname">短信企业ID:</label>
									<div class="col-md-10">
										<div class="clearfix">
											<input type="text" class="form-control"  name="userid"   id="userid" value="${messageChannel.userid}" />
										</div>
									</div>
								</div>

								<div class="form-group">
									<label class="control-label col-md-2 no-padding-right" for="cpname">账号:</label>
									<div class="col-md-10">
										<div class="clearfix">
											<input type="text" class="form-control"  name="account"   id="account" value="${messageChannel.account}" />
										</div>
									</div>
								</div>
								
								<div class="form-group">
									<label class="control-label col-md-2 no-padding-right" for="name">密码:</label>
									<div class="col-md-10">
										<div class="clearfix">
											<input type="password" class="form-control"  name="password"   id="password" value="${messageChannel.password}" />
										</div>
									</div>
								</div>
								
								<div class="form-group">
									<label class="control-label col-md-2 no-padding-right" for="name">扩展码:</label>
									<div class="col-md-10">
										<div class="clearfix">
											<input type="text" class="form-control" name="extno"   id="extno" value="${messageChannel.extno}" />
										</div>
									</div>
								</div>
								
								
								<div class="form-group">
									<label class="control-label col-md-2 no-padding-right" for="name">发送最小时间间隔（秒）:</label>
									<div class="col-md-10">
										<div class="clearfix">
											<input type="text" class="form-control" name="minimumInterval"   id="minimumInterval" value="${messageChannel.minimumInterval}" />
										</div>
									</div>
								</div>
								
								
								<div class="form-group">
									<label class="control-label col-md-2 no-padding-right" for="name">每日最大短信数量（条）:</label>
									<div class="col-md-10">
										<div class="clearfix">
											<input type="text" class="form-control"  name="warningLine"   id="warningLine" value="${messageChannel.warningLine}" />
										</div>
									</div>
								</div>
								
								
								
					
						</form>
						<!-- 表单结束 -->
						
						


						<!-- 提交开始 -->
	                    <div class="form-group">
	                    	<div class="col-md-8 center">
		                    	<button id="form-submit" type="button" onclick="mysubmit('validation-form')"  class="btn btn-primary">
									<i class="fa fa-save align-top bigger-125"></i>保存
								</button>
							 
								<button type="reset" class="btn">
									<i class="fa fa-pencil align-top bigger-125"></i>重置
								</button>
							</div>					
                   		</div>
						<!-- 提交结束  -->
				</div>
			</div>
			<!-- page-body end -->
		
	</div>		
	<!-- page-content end -->

</@htmlBody>



<@htmlBodyScript>



	<!-- 上传控件 -->
	<script type="text/javascript" src="${resources}/assets/js/ajaxfileupload.js"></script>
	<script>
	    /**
	     * 功能 : 提交表单
		 */
	 	function mysubmit(form){
	 		$("#"+form).submit();
	 	}
		
	</script>

	<!-- 验证框架 -->	
	<script src="${resources}/plugins/jquery-validation/jquery.validate.min.js"></script>
	<script src="${resources}/plugins/jquery-validation/messages_zh.min.js"></script>
	<script type="text/javascript">

			jQuery.validator.addMethod("isName", function(value, element) {       
	 			var corpName =  /^[\u0391-\uFFE5\w\-\s\.]{1,50}$/;
  				 return this.optional(element) || corpName.test(value);       
 			}, "请使用汉字、英文字母、数字、下划线、减号、空格或点");   
 			
	
			$('#validation-form').validate({
				errorElement: 'div',
				errorClass: 'help-block',
				focusInvalid: false,
				rules: {
					"corp.id": {
						required:true
					},
					sign: {
						required:true,
						maxlength: 32
					},
					url: {
						required:true,
						maxlength: 128
					},
					cpname: {
						required:true,
						maxlength: 32
					},
					cppassword: {
						required:true,
						maxlength: 32
					},
					extcode: {
						maxlength: 32
					}
				},
		
				messages: {
				},
		
		
				highlight: function (e) {
					$(e).closest('.form-group').removeClass('has-info').addClass('has-error');
				},
		
				success: function (e) {
					$(e).closest('.form-group').removeClass('has-error');//.addClass('has-info');
					$(e).remove();
				},
		
				errorPlacement: function (error, element) {
					if(element.is('input[type=checkbox]') || element.is('input[type=radio]')) {
						var controls = element.closest('div[class*="col-"]');
						if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
						else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
					}
					else if(element.is('.select2')) {
						error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));
					}
					else if(element.is('.chosen-select')) {
						error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));
					}
					else error.insertAfter(element.parent());
				},
		
				invalidHandler: function (form) {
				}
			});
	</script>
</@htmlBodyScript>